package com.neuedu.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Param {
   /* public static void main(String[] args) throws Exception {
    	//形成InputStream对象
		InputStream is=new FileInputStream(new File("src/db.propertis"));
		System.out.println((char)is.read());
		Properties p=new Properties();//properties对象
		p.load(is);//is加载到p中
		System.out.println(p.getProperty("user"));
	}*/
	
	static Properties p=new Properties();
	static {
		try {
			InputStream is=new FileInputStream(new File("src/db.properties"));
			p.load(is);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	//定义了四个对象：静态常量字符串
	public static final String DRVIER=p.getProperty("driver");
	
	public static final String URL=p.getProperty("url");
	public static final String USER=p.getProperty("user");
	public static final String PASSWORED=p.getProperty("password");
}
